<?php

/**
 * 错误异常处理器
 *
 * @author JiangJian <silverd@sohu.com>
 * $Id: Error.php 162 2012-11-09 04:04:30Z Jun.Lu.726@gmail.com $
 */
class Controller_Error extends Core_Controller_Web
{

    public function errorAction()
    {
        $exception = $this->get('exception');
        if (!$exception instanceof Exception) {
            exit('Access Denied');
        }

        switch ($exception->getCode()) {
            case 404:
                header404();
                break;

            default:
                if (!isDebug()) {
                    header500();
                }

                echo '<pre>';
                echo $exception;
                echo '</pre>';
        }

        return false;
    }

}